<?php

@session_start();

    include "mysql/mysql.php";
    $aa = new mysql;
    $aa->link("");
    include "myfunction.php";
    $bb= new myfunction;
	
	 
 if(@$_SESSION['userid'] == '' ){
	 @$_SESSION['userid'] = $bb->autologin();
	$_SESSION['userurl']= 'http://' . $_SERVER ['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
	}
	 //var_dump($_SESSION['userid']);	
?>

<style type="text/css">
#head{background-color:#FFF; 
      height: 80px; 
      box-shadow:3px 3px 3px #999999;
	  _webkit-box-shadow:3px 3px 3px #999999;
	  _moz-box-shadow:3px 3px 3px #999999;
 }

#head td{padding-right: 29px;
         padding-top: 5px;
        }


a{text-decoration:none;}

#img1{width: 50px; height: 50px;}
#img2, #img3{width: 30px; height: 30px;}



#h33{
	display: block;
	}
#h33:hover .xfk{
	width: 150px;
	height: 400px;
	border: 1px solid #CCC;
	zoom: 1;
	border-radius: 10px;
	background-color: #FFF;
	
	-moz-box-shadow:3px 3px 3px rgba(204,204,204, 1) inset,
	                3px 3px 3px rgba(204,204,204, 1) ;           
	-webkit-box-shadow:3px 3px 3px rgba(204,204,204, 1) inset,
		               3px 3px 3px rgba(204,204,204, 1) ;       
	box-shadow:3px 3px 3px rgba(204,204,204, 1) inset,           
		       3px 3px 3px rgba(204,204,204, 1) ;
}
.xfk{
	width: 0px;
	height: 0px;
	overflow: hidden;
	position: relative;
	top: 10px;
	left: -20px;
	zoom: 1;
	-webkit-transition: all .3s;
	-moz-transition: all .3s;
	-ms-transition: all .3s;
	-o-transition: all .3s;
	margin: 0;
	padding: 0;
	}
.pic01{
	margin: 0;
	padding: 10px;
	width: 128px;
	height: 128px;
	}
.pic01 img{
	width: 100px;
	height: 100px;
	display: block;
	margin: 0 auto;
	}
.lie01 ul{
	margin: 0;
		}
.lie01 li{
	margin: 0;
	list-style: none;
	text-align: center;
	line-height: 40px;
	height: 40px;
	border-bottom: 1px solid #CCC;
	}
.lie01 li:hover{
	background-color: #00F;
	color: #FFF;
	font-weight: bold;
	}

#xfknum{
	width: 15px;
	height: 15px;
	overflow: hidden;
	position: relative;
	top: -10px;
	left: 20px;
	zoom: 1;
	margin: 0;
	padding: 0;

	}


</style>
<?php
                   
				  
					
					if(@$_POST['tuidl'] == '安全退出'){ 
					   @$_SESSION['userid'] = '';
					}
					?>

<div id="head">
    <table style="width:1100px; margin: auto;" align="center">
        <tr>
            <td style="width:150px"><img src="img/head-logo.jpg" id="img1"/>
            
            </td> 
            <td><a href="homepage.php">官方主页</a></td> <td><a href="shoppingmall.php">在线商城</a></td> 
            <td><a href="product1.php"><?php echo @$product1; ?>smartisan T3</a></td> <td><a href="product2.php">坚果 Pro2<?php echo @$product2; ?></a></td> 
            <td><a href="smartisanOS.php">samrtisan OS</a></td> <td><a href="download.php">应用下载</a></td>
            <td><a href="bbs.php">官方论坛</a></td> <td>|</td>
            <td id="dlk">
                
                <?php
                    if(@$_SESSION['userid'] == ''){ 
					// var_dump(@$_SESSION['userid']);echo 1;
					?>
                <a href="user/login.php">登录</a>
                <?php }
				       else{ 
					       $userid = @$_SESSION['userid'];
						  // var_dump($_SESSION['userid']);echo 2;
					       $user = $bb->finduser($userid);
					   ?>
                       <div id="h33" style=" width: 30px; height: 30px;">
                       <a href="userinfo.php?id=<?php echo $user['id']; ?>"><img src="<?php if($user['img'] != ''){ echo $user['img'];}else{ echo 'user/img/mopic.jpg';} ?>" id="img3" /></a>
                       
                 
                     <div class="xfk">
                     
                         <div class="pic01">
                             <img src="<?php if(@$user['img'] != ''){ echo $user['img'];}else{ echo 'user/img/mopic.jpg';} ?> "/>
                             <p id="userid"><small><?php echo $user['user_name']; ?></small></p>
                         </div>
                         <div class="lie01">
              <ul>
                  <li>我的订单</li>
                  <li>售后服务</li>
                  <li>我的优惠</li>
                  <li>账户资料</li>
                  <li><form method="post" action=""><input type="submit" name="tuidl" value="安全退出"></form></li>
              </ul>
                         </div>
                     
                     </div>
                     <?php } ?>
                 </div>
             </td> 
             <td><div id="h44"><a href="car.php"><img src="img/head-shoppingcar.jpg" id="img2" /></a>
                 <?php
				     if(@$userid != ''){
						// var_dump(@$userid);
						 $probuy = $bb->findprocar(@$userid);
				         if($probuy != ''){
				         $num = mysqli_num_rows($probuy);  //var_dump($num);
				         // $num = intdiv($num, 9);     
				 ?>
                    <div id="xfknum" style=" "><p id="carnum" style=" width: 15px; height: 15px; line-height: 15px; color: #FFF; background-color: red; border-radius: 15px; margin: 0; padding: 0; text-align: center; "><?php echo $num; ?></p>       
                  <?php
						 } }
				 ?>
                 </div></div>
             </td>
        </tr>
    </table>
</div>